package com.tiancheng.trade.merchant.enums;

import com.tiancheng.trade.commom.core.enums.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.Arrays;
import java.util.Optional;

@Getter
@AllArgsConstructor
public enum MerchantApplyStatusEnums implements BaseEnum<String> {

    ing("0", "申请中"),
    success("1", "成功"),
    final_error("2", "最终失败"),
    exception("3", "有步骤异常，但总流程不终结，修复后继续");


    private final String code;
    private final String msg;

    public static Optional<MerchantApplyStatusEnums> getByCode(String code) {
        return Arrays.stream(MerchantApplyStatusEnums.values()).filter(m -> m.getCode().equals(code)).findFirst();
    }

    ;
}
